; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-- -O0 -fast-isel=false -optimize-regalloc -regalloc=basic | FileCheck %s
; PR2343

	%llvm.dbg.anchor.type = type { i32, i32 }
	%struct.CUMULATIVE_ARGS = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
	%struct.VEC_basic_block_base = type { i32, i32, [1 x ptr] }
	%struct.VEC_basic_block_gc = type { %struct.VEC_basic_block_base }
	%struct.VEC_edge_base = type { i32, i32, [1 x ptr] }
	%struct.VEC_edge_gc = type { %struct.VEC_edge_base }
	%struct.VEC_rtx_base = type { i32, i32, [1 x ptr] }
	%struct.VEC_rtx_gc = type { %struct.VEC_rtx_base }
	%struct.VEC_temp_slot_p_base = type { i32, i32, [1 x ptr] }
	%struct.VEC_temp_slot_p_gc = type { %struct.VEC_temp_slot_p_base }
	%struct.VEC_tree_base = type { i32, i32, [1 x ptr] }
	%struct.VEC_tree_gc = type { %struct.VEC_tree_base }
	%struct.__sbuf = type { ptr, i32 }
	%struct._obstack_chunk = type { ptr, ptr, [4 x i8] }
	%struct.basic_block_def = type { ptr, ptr, ptr, ptr, ptr, [2 x ptr], ptr, ptr, %struct.basic_block_il_dependent, ptr, ptr, i64, i32, i32, i32, i32 }
	%struct.basic_block_il_dependent = type { ptr }
	%struct.bitmap_element_def = type { ptr, ptr, i32, [4 x i32] }
	%struct.bitmap_head_def = type { ptr, ptr, i32, ptr }
	%struct.bitmap_obstack = type { ptr, ptr, %struct.obstack }
	%struct.block_symbol = type { [3 x %struct.cfg_stats_d], ptr, i64 }
	%struct.cfg_stats_d = type { i32 }
	%struct.control_flow_graph = type { ptr, ptr, ptr, i32, i32, i32, ptr, i32 }
	%struct.def_optype_d = type { ptr, ptr }
	%struct.edge_def = type { ptr, ptr, %struct.edge_def_insns, ptr, ptr, i32, i32, i64, i32 }
	%struct.edge_def_insns = type { ptr }
	%struct.edge_prediction = type { ptr, ptr, i32, i32 }
	%struct.eh_status = type opaque
	%struct.emit_status = type { i32, i32, ptr, ptr, ptr, i32, %struct.__sbuf, i32, ptr, ptr }
	%struct.et_node = type opaque
	%struct.expr_status = type { i32, i32, i32, ptr, ptr, ptr }
	%struct.function = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, %struct.CUMULATIVE_ARGS, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i64, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, i32, i32, ptr, ptr, ptr, i32, i32, i32, %struct.__sbuf, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i8, i8, i8, i8 }
	%struct.htab = type { ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32 }
	%struct.initial_value_struct = type opaque
	%struct.lang_decl = type opaque
	%struct.language_function = type opaque
	%struct.loop = type { i32, ptr, ptr, %llvm.dbg.anchor.type, i32, i32, i32, i32, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
	%struct.machine_function = type opaque
	%struct.maydef_optype_d = type { ptr, ptr, ptr, %struct.ssa_use_operand_d }
	%struct.nb_iter_bound = type { ptr, ptr, ptr }
	%struct.object_block = type { ptr, i32, i64, ptr, ptr }
	%struct.obstack = type { i32, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, i8 }
	%struct.rtl_bb_info = type { ptr, ptr, ptr, ptr, ptr, ptr, i32 }
	%struct.rtx_def = type { i16, i8, i8, %struct.u }
	%struct.section = type { %struct.unnamed_section }
	%struct.sequence_stack = type { ptr, ptr, ptr }
	%struct.ssa_use_operand_d = type { ptr, ptr, ptr, ptr }
	%struct.stmt_ann_d = type { %struct.tree_ann_common_d, i8, ptr, %struct.stmt_operands_d, ptr, i32, ptr }
	%struct.stmt_operands_d = type { ptr, ptr, ptr, ptr, ptr }
	%struct.temp_slot = type opaque
	%struct.tree_ann_common_d = type { i32, ptr, ptr }
	%struct.tree_ann_d = type { %struct.stmt_ann_d }
	%struct.tree_common = type { ptr, ptr, ptr, i8, i8, i8, i8, i8 }
	%struct.tree_decl_common = type { %struct.tree_decl_minimal, ptr, i8, i8, i8, i8, i8, i32, %struct.tree_decl_u1, ptr, ptr, ptr, ptr, i64, ptr }
	%struct.tree_decl_minimal = type { %struct.tree_common, %struct.__sbuf, i32, ptr, ptr }
	%struct.tree_decl_non_common = type { %struct.tree_decl_with_vis, ptr, ptr, ptr, ptr }
	%struct.tree_decl_u1 = type { i64 }
	%struct.tree_decl_with_rtl = type { %struct.tree_decl_common, ptr, i32 }
	%struct.tree_decl_with_vis = type { %struct.tree_decl_with_rtl, ptr, ptr, i8, i8, i8 }
	%struct.tree_function_decl = type { %struct.tree_decl_non_common, i8, i8, i64, ptr }
	%struct.tree_node = type { %struct.tree_function_decl }
	%struct.u = type { %struct.block_symbol }
	%struct.unnamed_section = type { %struct.cfg_stats_d, ptr, ptr, ptr }
	%struct.use_optype_d = type { ptr, %struct.ssa_use_operand_d }
	%struct.var_refs_queue = type { ptr, i32, i32, ptr }
	%struct.varasm_status = type opaque
	%struct.vuse_optype_d = type { ptr, ptr, %struct.ssa_use_operand_d }
@llvm.used = appending global [1 x ptr] [ ptr @tree_redirect_edge_and_branch ], section "llvm.metadata"		; <ptr> [#uses=0]

define ptr @tree_redirect_edge_and_branch(ptr %e1, ptr %dest2) nounwind  {
; CHECK-LABEL: tree_redirect_edge_and_branch:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    pushl %esi
; CHECK-NEXT:    movb $1, %cl
; CHECK-NEXT:    xorl %edx, %edx
; CHECK-NEXT:    # implicit-def: $esi
; CHECK-NEXT:    jmp .LBB0_2
; CHECK-NEXT:  .LBB0_1: # %bb483
; CHECK-NEXT:    # in Loop: Header=BB0_2 Depth=1
; CHECK-NEXT:    movl 0, %edx
; CHECK-NEXT:    xorl %ecx, %ecx
; CHECK-NEXT:    movl %eax, %esi
; CHECK-NEXT:    jmp .LBB0_2
; CHECK-NEXT:  .LBB0_2: # %bb497
; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1
; CHECK-NEXT:    movl %edx, %eax
; CHECK-NEXT:    testb $1, %cl
; CHECK-NEXT:    jne .LBB0_1
; CHECK-NEXT:    jmp .LBB0_3
; CHECK-NEXT:  .LBB0_3: # %bb502
; CHECK-NEXT:    testb $1, %cl
; CHECK-NEXT:    je .LBB0_5
; CHECK-NEXT:    jmp .LBB0_4
; CHECK-NEXT:  .LBB0_4: # %bb507
; CHECK-NEXT:    movl $0, (%esi)
; CHECK-NEXT:    jmp .LBB0_5
; CHECK-NEXT:  .LBB0_5: # %bb841
entry:
	br label %bb497

bb483:		; preds = %bb497
	%tmp496 = load ptr, ptr null, align 4		; <ptr> [#uses=1]
	br label %bb497

bb497:		; preds = %bb483, %entry
	%cases.0 = phi ptr [ %tmp496, %bb483 ], [ null, %entry ]		; <ptr> [#uses=1]
	%last.0 = phi ptr [ %cases.0, %bb483 ], [ undef, %entry ]		; <ptr> [#uses=1]
	%foo = phi i1 [ 0, %bb483 ], [ 1, %entry ]
	br i1 %foo, label %bb483, label %bb502

bb502:		; preds = %bb497
	br i1 %foo, label %bb507, label %bb841

bb507:		; preds = %bb502
	%tmp517 = getelementptr %struct.tree_node, ptr %last.0, i32 0, i32 0		; <ptr> [#uses=1]
	%tmp519 = getelementptr %struct.tree_common, ptr %tmp517, i32 0, i32 0		; <ptr> [#uses=1]
	store ptr null, ptr %tmp519, align 4
	br label %bb841

bb841:		; preds = %bb507, %bb502
	unreachable
}
